//导入 http 模块
const http = require('http');
const port = 3000;
const fs = require('fs');

//创建服务对象
const server = http.createServer((req, res) => {
  //设置响应头
  res.setHeader('content-type','text/html;charset=utf-8');
  //读取文件的内容
  let html = fs.readFileSync('./html/01_index.html');
  //响应 HTML 网页
  res.end(html);
});

//监听端口启动服务
server.listen(port, () => {
  console.log('running....');
});